package logic;

import java.io.Serializable;

/**
 * This class create a Reader and enable to create it with few fields. 
 */
public class Reader implements Serializable {

	private int readerID;
	private String username;
	private String password;
	private String cellphone;
	private String email;
	private String status;
	private int isConnected;
 	private boolean graduate;
	
	public Reader() {
		this.cellphone="";
		this.email="";
		this.password="";
		this.status="";
		this.username="";
		isConnected=0;
	}
	
	/**
	   * Constructs an instance of the reader.
	   *
	   * @param readerID is the ID Number of the reader.
	   */
	public Reader(int  readerID)
	{
		this.readerID=readerID;
		
	}
	/**
	 *  Constructs an fields of the reader.
	 * 
	 * @param r is the reader instance
	 */
	public Reader(Reader r) {
		this.cellphone=r.getCellphone();
		this.email=r.getEmail();
		this.password=r.getPassword();
		this.status=r.getStatus();
		this.username=r.getUsername();
		this.readerID=r.getReaderId();
		this.isConnected=0;
		
	}
	
	/**
	 * Constructs the fields with given values
	 * 
	 * @param username is the reader name
	 * @param password is the password
	 * @param cellphone is the reader phone number
	 * @param email	is the reader Email
	 */
	public Reader(String username,String password,String cellphone,String email)
	{
		this.cellphone=cellphone;
		this.email=email;
		this.password=password;
		this.username=username;
		isConnected=1;
	}
	
	/**
	 * Constructs the fields with given values
	 * 
	 * @param readerID is the ID number of the reader
	 * @param username is the reader name
	 * @param password is the password
	 * @param cellphone is the reader phone number
	 * @param email	is the reader Email
	 */
	public Reader(int readerID,String username,String password,String cellphone,String email)
	{
		this.readerID=readerID;
		this.cellphone=cellphone;
		this.email=email;
		this.password=password;
		this.username=username;
		isConnected=1;
	}
	
	/**
	 * Constructs the fields with given values
	 * 
	 * @param readerID is the ID number of the reader
	 * @param username is the reader name
	 * @param password is the password
	 * @param cellphone is the reader phone number
	 * @param email	is the reader Email
	 * @param graduate is the readers Degree
	 */
	public Reader(int readerID,String username,String password,String cellphone,String email,Boolean graduate)
	{
		this.readerID=readerID;
		this.cellphone=cellphone;
		this.email=email;
		this.password=password;
		this.username=username;
		this.graduate=graduate;
		isConnected=1;
	}
	
	/**
	 * Constructs the fields with given values
	 * 
	 * @param username is the reader name
	 * @param password is the password
	 * @param cellphone is the reader phone number
	 * @param email	is the reader Email
	 * @param status mean if the reader is activate or frozen
	 */
	public Reader(String username,String password,String cellphone,String email,String status)
	{
		this.cellphone=cellphone;
		this.email=email;
		this.password=password;
		this.status=status;
		this.username=username;
		isConnected=1;
	}
	
	/**
	 * Constructs the fields with given values
	 * 
	 * @param readerID is the ID number of the reader
	 * @param username is the reader name
	 * @param password is the password
	 * @param cellphone is the reader phone number
	 * @param email	is the reader Email
	 * @param status mean if the reader is activate or frozen
	 */
	public Reader(int readerID,String username,String password,String cellphone,String email,String status)
	{	this.readerID=readerID;
		this.cellphone=cellphone;
		this.email=email;
		this.password=password;
		this.status=status;
		this.username=username;
		isConnected=1;
	}
	
	/**
	 * This Set reader's ID
	 * @param readerID is reader's ID
	 */
	public void setReaderId(int readerID)
	{
		 this.readerID=readerID;
	}
	
	/**
	 * Change status of reader 
	 * @param status is the new status- activated/frozen/locked
	 */
	public void changeStatus(String status)
	{
		this.status=status;
	}
	
	/**
	 * This Set reader's Email address
	 * @param email is reader's Email
	 */
	public void setEmail(String email)
	{
		this.email=email;
	}
	
	/**
	 * Get the reader's Email
	 * @return the reader's Email
	 */
	public String getEmail()
	{
		return this.email;
	}
	
	/**
	 * This Set reader's phone Number
	 * @param cellphone is reader's phone number
	 */
	public void setCellphone(String cellphone)
	{
		this.cellphone=cellphone;
	}
	
	/**
	 * Get the reader's phone Number
	 * @return the reader's phone Number
	 */
	public String getCellphone()
	{
		return this.cellphone;
	}
	
	/**
	 * Get the reader's password
	 * @return the reader's password
	 */
	public String getPassword()
	{
		return this.password;
	}
	
	/**
	 * This Set reader's password
	 * @param password is the entire password
	 */
	public void setPassword(String password)
	{
		this.password=password;
	}
	
	/**
	 * Get the reader's status
	 * @return the reader's status
	 */
	public String getStatus()
	{
		return this.status;
	}
	
	/**
	 * This Set reader's status
	 * @param status is the entire status
	 */
	public void setStatus(String status)
	{
		 this.status=status;
	}
	
	/**
	 * Get the reader's status
	 * @return the reader's user name
	 */
	public String getUsername()
	{
		return this.username;
	}
	
	/**
	 * This set the user name 
	 * @param username is the entire user name
	 */
	public void setUsername(String username)
	{
		this.username=username;
	}
	
	/**
	 * Get the Reader's IDNumber
	 * @return the Reader's IDNumber
	 */
	public int getReaderId()
	{
		return this.readerID;
	}
	
	/**
	 * Get if the reader is connected or not
	 * @return 1 if the reader connected or not
	 */
	public int getIsConnected()
	{
		return isConnected;
	}
	
	/**
	 * This set the user name
	 * @param isConnected is say if the reader is connected or not
	 */
	public void setIsConnected(int isConnected)
	{
		this.isConnected=isConnected;
	}
	
	/**
	 * Get is the reader Graduate OR not
	 * @return TRUE if the reader is Graduate and FALSE if not
	 */
	public Boolean getGraduate()
	{
		return this.graduate;
	}
	
	/**
	 * This set the reader is Graduate or not
	 * @param graduate says if the reader is Graduate or not
	 */
	public void setGraduate(Boolean graduate)
	{
		this.graduate=graduate;
	}
	
	
}